using System;
using NUnit.Framework;
using ValidationFramework;

namespace ExampleLibraryCSharp.PropertyValidationManagerExamples
{
	public class ExternalExplicitExample
	{
		#region Example
		public class Person : IPerson
		{

			int IPerson.Age
			{
				get;
				set;
			}

		}
		public interface IPerson
		{
			[RequiredIntRule]
			int Age
			{
				get;
				set;
			}
		}


        [TestFixture]
		public class ExampleUsage
		{
            [Test]
			public void Run()
			{
                IPerson person = new Person();
				var propertyValidationManager = new PropertyValidationManager(person);
				//Could have called propertyValidationManager.Validate() here to validate all properties 
                propertyValidationManager.Validate("ExampleLibraryCSharp.PropertyValidationManagerExamples.ExternalExplicitExample.IPerson.Age");
				Console.WriteLine(propertyValidationManager.IsValid);
				person.Age = 99;
				//Could have called propertyValidationManager.Validate() here to validate all properties 
                propertyValidationManager.Validate("ExampleLibraryCSharp.PropertyValidationManagerExamples.ExternalExplicitExample.IPerson.Age");
				Console.WriteLine(propertyValidationManager.IsValid);
				Console.ReadLine();
			}
		}
		#endregion
	}
}